# This dockerfile is specific to building the network metrics daemon for OpenShift
FROM openshift/golang-builder@sha256:4820580c3368f320581eb9e32cf97aeec179a86c5749753a14ed76410a293d83 AS builder
ENV __doozer=update BUILD_RELEASE=202202160023.p0.gab62184.assembly.stream BUILD_VERSION=v4.10.0 OS_GIT_MAJOR=4 OS_GIT_MINOR=10 OS_GIT_PATCH=0 OS_GIT_TREE_STATE=clean OS_GIT_VERSION=4.10.0-202202160023.p0.gab62184.assembly.stream SOURCE_GIT_TREE_STATE=clean 
ENV __doozer=merge OS_GIT_COMMIT=ab62184 OS_GIT_VERSION=4.10.0-202202160023.p0.gab62184.assembly.stream-ab62184 SOURCE_DATE_EPOCH=1639398091 SOURCE_GIT_COMMIT=ab62184d9084039e0b580fb58d7ffaf41b176584 SOURCE_GIT_TAG=ab62184 SOURCE_GIT_URL=https://github.com/uccps-samples/network-metrics-daemon 

# Add everything
ENV PKG_NAME=github.com/uccps-samples/network-metrics-daemon
ENV PKG_PATH=/go/src/$PKG_NAME
RUN mkdir -p $PKG_PATH

COPY . $PKG_PATH/
WORKDIR $PKG_PATH

RUN make build-bin

WORKDIR /

FROM openshift/ose-base:v4.10.0.20220216.010142
ENV __doozer=update BUILD_RELEASE=202202160023.p0.gab62184.assembly.stream BUILD_VERSION=v4.10.0 OS_GIT_MAJOR=4 OS_GIT_MINOR=10 OS_GIT_PATCH=0 OS_GIT_TREE_STATE=clean OS_GIT_VERSION=4.10.0-202202160023.p0.gab62184.assembly.stream SOURCE_GIT_TREE_STATE=clean 
ENV __doozer=merge OS_GIT_COMMIT=ab62184 OS_GIT_VERSION=4.10.0-202202160023.p0.gab62184.assembly.stream-ab62184 SOURCE_DATE_EPOCH=1639398091 SOURCE_GIT_COMMIT=ab62184d9084039e0b580fb58d7ffaf41b176584 SOURCE_GIT_TAG=ab62184 SOURCE_GIT_URL=https://github.com/uccps-samples/network-metrics-daemon 
COPY --from=builder /go/src/github.com/uccps-samples/network-metrics-daemon/bin/network-metrics-daemon /usr/bin/network-metrics


CMD ["/usr/bin/network-metrics"]

LABEL \
        io.k8s.display-name="Network Metrics Daemon" \
        io.k8s.description="This is a component of OpenShift Container Platform and provides a daemon that exposes admission controller for Multus CNI custom resources." \
        io.openshift.tags="openshift" \
        maintainer="Federico Paolinelli <fpaoline@redhat.com>" \
        name="openshift/ose-network-metrics-daemon" \
        com.redhat.component="ose-network-metrics-daemon-container" \
        io.openshift.maintainer.product="OpenShift Container Platform" \
        io.openshift.maintainer.component="Networking" \
        io.openshift.maintainer.subcomponent="multus" \
        release="202202160023.p0.gab62184.assembly.stream" \
        io.openshift.build.commit.id="ab62184d9084039e0b580fb58d7ffaf41b176584" \
        io.openshift.build.source-location="https://github.com/uccps-samples/network-metrics-daemon" \
        io.openshift.build.commit.url="https://github.com/uccps-samples/network-metrics-daemon/commit/ab62184d9084039e0b580fb58d7ffaf41b176584" \
        version="v4.10.0"

